#include <log4cpp/Category.hh>
#include <log4cpp/OstreamAppender.hh>
#include <log4cpp/BasicLayout.hh>
#include <log4cpp/FileAppender.hh>
#include <iostream>

class Logger {
private:
    static log4cpp::Category& root;

    Logger() {}
public:
    static void init(const std::string& logFilePath) {
        log4cpp::OstreamAppender* osAppender = new log4cpp::OstreamAppender("console", &std::cout);
        osAppender->setLayout(new log4cpp::BasicLayout());

        log4cpp::FileAppender* fileAppender = new log4cpp::FileAppender("default", logFilePath);
        fileAppender->setLayout(new log4cpp::BasicLayout());

        root.addAppender(osAppender);
        root.addAppender(fileAppender);
    }

    static void error(const std::string& message) {
        root.error(message);
    }

    static void warn(const std::string& message) {
        root.warn(message);
    }

    static void info(const std::string& message) {
        root.info(message);
    }

    static void debug(const std::string& message) {
        root.debug(message);
    }
};

log4cpp::Category& Logger::root = log4cpp::Category::getRoot();

